<?php 
$this->load->view('admin/layout/head', array('title'=>'后台管理', 'nav' => 'product'), FALSE);
?>

<div id="container">
	<div class="toolbar">
		<a href="/admin/category/create" class="btn btn-default add-btn"><span class="glyphicon glyphicon-plus"></span> <?= $this->lang->line('create') ?></a>
	</div>

	<div class="table-container mt-10">
		<?php foreach($categories as $cate): ?>
		<?php if($cate['parent_id'] == 0): ?>
		<div class="cate-div">
			<div class="t cate-item"><span><?php echo $cate['title'] ?></span><a href="/admin/category/edit/<?php echo $cate['id']?>"><?= $this->lang->line('edit') ?></a><a href="javascript:;" cate_id="<?php echo $cate['id'] ?>" class="del-btn simple-action" data-url="<?= site_url('admin/category/delete/'.$cate['id']) ?>" data-action="delete"><?= $this->lang->line('delete') ?></a></div>
			<div class="d">
				<?php foreach($categories as $cate2):?>
				<?php if($cate['id'] == $cate2['parent_id']): ?>
				<div class="cate-item">
					<span><?php echo $cate2['title'] ?></span>
					<a href="/admin/category/edit/<?php echo $cate2['id']?>"><?= $this->lang->line('edit') ?></a><a href="javascript:;" cate_id="<?php echo $cate2['id'] ?>" class="del-btn simple-action" data-url="<?= site_url('admin/category/delete/'.$cate2['id']) ?>" data-action="delete"><?= $this->lang->line('delete') ?></a>
				</div>
				<?php endif; ?>
				<?php endforeach; ?>
			</div>
		</div>
		<?php endif; ?>
		<?php endforeach; ?>
	</div>
</div>

<?php 
$this->load->view('admin/layout/footer');
?>